<?php

class GamesWidget extends CWidget {
    
    public function run() {
        // Get news            
        $models = Game::model()->findAll('status=:status AND hot=:hot LIMIT 0,4', array(':status'=>1, ':hot'=>1));     
        
        $models2 = Post::model()->findAll('category_id =:category_id AND status=:status ORDER BY create_time DESC LIMIT 0,4', array(':category_id'=>2, ':status'=>1));        
        $criteria = new CDbCriteria();
        $criteria->addCondition('type = 4');
        $criteria->limit = 4;
        $criteria->order = "id DESC";
        $banners = Banner::model()->findAll($criteria);
        $this->render('game', array(
            'models'=>$models,
            'banners'=>$banners,
            'models2'=>$models2
        ));
    }
}
?>
